package com.hptpd.questionnairesurvey.controller.admin;

import com.hptpd.questionnairesurvey.component.Result;
import com.hptpd.questionnairesurvey.service.IStatisticService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * \* Created with IntelliJ IDEA.
 * \* Date: 2019/11/16
 * \*
 * \* Description:
 * \
 *
 * @author walter_long
 */
@RestController
@RequestMapping("/api/admin")
public class StatisticController {
    @Resource(name = "iStatisticService")
    private IStatisticService iStatisticService;

    /**
     * 调查反馈量，已做人数按部门划分分析
     * @param surveyId String
     * @return Result
     */
    @RequestMapping(value = "/statistic/survey/feedback", method = RequestMethod.GET)
    public Result getSurveyFeedbackByRootDepartment(
            @RequestParam String surveyId) {
        return iStatisticService.getSurveyFeedbackByRootDepartment(surveyId);
    }

    /**
     * 调查平均分，按部门划分分析
     * @param surveyId String
     * @return Result
     */
    @RequestMapping(value = "/statistic/survey/avgScore", method = RequestMethod.GET)
    public Result getSurveyAvgScoreByRootDepartment(
            @RequestParam String surveyId) {
        return iStatisticService.getSurveyAvgScoreByRootDepartment(surveyId);
    }

    /**
     * 维度评分， 按部门划分分析
     * @param surveyId String
     * @return Result
     */
    @RequestMapping(value = "/statistic/survey/dimensionality/avgScore", method = RequestMethod.GET)
    public Result getSurveyDimensionalityScoreByRootDepartment(
            @RequestParam String surveyId) {
        return iStatisticService.getSurveyDimensionalityScoreByRootDepartment(surveyId);
    }
}
